#!/usr/bin/python
# -*- encoding: utf-8 -*-
'''
@File    :   3.py
@Time    :   2020/05/04 21:48:27
@Author  :   Malygos_l 
@Version :   1.0
@Contact :   751756061@qq.com
@WebSite :   www.gitee.com/malygos_l
'''
#从键盘输入5个同学的账号和密码,然后将他们的姓名,账号和密码(密码需要加密)保存到一个文件中;
        # Tom   admin   XXXXX
        # Jack   root      XXXXX 
# Start typing your code from here

import hashlib

def nup():
    (a,b,c) = eval(input())
    nupinfo = [a,b,c]
    return nupinfo

info = []
for i in range(5):
    info.append(nup())

# 保存在nup.txt文件中
try:
    f = open('homework4/nup.txt','w',encoding='UTF-8')
    for a in info:
        md5 = hashlib.md5()
        md5.update(a[2].encode('UTF-8'))
        f.write("%s %s %s\n" %(a[0],a[1],md5.hexdigest()))
    f.close()
    print("Success!")

except IOError:
    print("ERROR!")

# testdata:
# 'malygos0','malygos_l0','18311010'
# 'malygos1','malygos_l1','18311011'
# 'malygos2','malygos_l2','18311012'
# 'malygos3','malygos_l3','18311013'
# 'malygos4','malygos_l4','18311014'
